package cn.itsource.ymcc.web.controller;

import cn.itsource.ymcc.dto.AlipayNotifyDto;
import cn.itsource.ymcc.dto.PayDto;
import cn.itsource.ymcc.result.JSONResult;
import cn.itsource.ymcc.service.IPayOrderService;
import cn.itsource.ymcc.service.IPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/pay")
public class PayController {
    @Autowired
    private IPayService payService;
    @PostMapping("/apply")
    public JSONResult apply(@RequestBody PayDto dto){
        String apply = payService.apply(dto);
        return JSONResult.success(apply);
    }

    @PostMapping("/alipay/notify")
    public String notify(AlipayNotifyDto dto){
        //Map<String, String[]> parameterMap = request.getParameterMap();
        String s = payService.payNotify(dto);
        return s;
    }
}
